package org.quipu.domain;

import java.io.Serializable;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;

@Entity
@Table(name = "SETTINGS", uniqueConstraints = 
        @UniqueConstraint(columnNames = {"PARAM_KEY", "ID_USER"})
)
public class Settings extends UniqueEntity implements Serializable {

    public static final String CLEAR_NEW_INCOME = "clearNewIncome";
    public static final String CLEAR_NEW_OUTCOME = "clearNewOutcome";
    public static final String CLEAR_NEW_TRANSFER = "clearNewTransfer";

    @Column(name = "PARAM_KEY", nullable = false)
    private String key;

    @Column(name = "PARAM_VALUE", nullable = true)
    private String value;

    @JoinColumn(name = "ID_USER", referencedColumnName = "ID", nullable = true)
    @ManyToOne
    private User user;

    public String getKey() {
        return key;
    }

    public void setKey(String key) {
        this.key = key;
    }

    public String getValue() {
        return value;
    }

    public void setValue(String value) {
        this.value = value;
    }

    public User getUser() {
        return user;
    }

    public void setUser(User user) {
        this.user = user;
    }

    @Override
    public String toString() {
        return "{ key=" + key + "; value=" + value + "; user=" + user + " }";
    }
}
